package com.viphuli.http.handler;

import android.view.View;

import com.viphuli.common.Constants;
import com.viphuli.fragment.PurchaseOrderFillFragment;
import com.viphuli.http.bean.page.PurchaseOrderInfoPage;
import com.viphuli.http.bean.part.PurchaseOrder;

public class PurchaseOrderFillInfoResponseHandler extends MyBaseHttpResponseHandler<PurchaseOrderFillFragment, PurchaseOrderInfoPage> {

	@Override
	public void deal() {
		PurchaseOrder order = page.getOrder();

		//填充数据
		caller.getOrderSite().setText(order.getAddress());
		caller.getOrderBetterSite().setText(order.getBetterAddress());
		caller.getOrderPhone().setText(order.getTel());
		caller.getOrderContacts().setText(order.getPersonContact());
		caller.setServiceType(order.getServiceType());
		caller.setServiceItemId(order.getServiceItemId());

		//控制邮箱显示及初始化数量（企业预约服务显示邮箱，个人预约不显示）
		if (Constants.HOME_SERVICE_HEALTH_COMPANY == order.getServiceType()) {
			caller.getOrderEMailLayout().setVisibility(View.VISIBLE);//企业体检
			caller.getOrderPeopleNumText().setText(String.valueOf(Constants.ORDER_MIN_NUMBER_COMPANY));
		} else {
			caller.getOrderEMailLayout().setVisibility(View.GONE);
			caller.getOrderPeopleNumText().setText(String.valueOf(Constants.ORDER_MIN_NUMBER_PERSON));
		}

		//隐藏加载对话框
		caller.notEmpty();
	}

}
